package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstUserInfoExpandDao;
import com.financing.wap.dto.DstUserInfoExpandDTO;
import com.financing.wap.service.IDstUserInfoExpandService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_user_info_expand  
 * 用户扩展名片信息 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstUserInfoExpandService")
public class DstUserInfoExpandServiceImpl implements IDstUserInfoExpandService{

	@Autowired
	private IDstUserInfoExpandDao dstUserInfoExpandDao;

	@Override
	public int insert(DstUserInfoExpandDTO dstUserInfoExpand) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstUserInfoExpand);
		DTOdateSetUtil.setUpdateInfo(dstUserInfoExpand);
		dstUserInfoExpand.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstUserInfoExpandDao.insert(dstUserInfoExpand);
	}

	@Override
	public void update(DstUserInfoExpandDTO dstUserInfoExpand) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserInfoExpand);
		dstUserInfoExpandDao.update(dstUserInfoExpand);
	}

	@Override
	public void updateForce(DstUserInfoExpandDTO dstUserInfoExpand) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserInfoExpand);
		dstUserInfoExpandDao.updateForce(dstUserInfoExpand);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstUserInfoExpandDao.delete(id);
	}
	
	@Override
	public List<DstUserInfoExpandDTO> queryList(DstUserInfoExpandDTO dstUserInfoExpand) throws SQLException {
		return dstUserInfoExpandDao.queryList(dstUserInfoExpand);
	}

	@Override
	public int queryListCount(DstUserInfoExpandDTO dstUserInfoExpand) throws SQLException {
		return dstUserInfoExpandDao.queryListCount(dstUserInfoExpand);
	}

	@Override
	public DstUserInfoExpandDTO loadById(Integer id) throws SQLException {
		return dstUserInfoExpandDao.loadById(id);
	}
 	@Override
	public DstUserInfoExpandDTO queryListGetFirst(DstUserInfoExpandDTO dstUserInfoExpand)
			throws SQLException {
		 List<DstUserInfoExpandDTO> queryList = queryList(dstUserInfoExpand);
		 if(queryList==null||queryList.size()==0){
			 return new DstUserInfoExpandDTO();
		 }
		 return queryList.get(0);
	}
}
